<template>
  <div class="testclass">
    <el-button type="primary" @click="checkServerStatus">服务状态</el-button>
    <el-table :data="serviceStatus" style="width: 100%">
      <el-table-column prop="name" label="服务名称"></el-table-column>
      <el-table-column prop="state" label="运行状态"></el-table-column>
      <el-table-column prop="starttime" label="启动时间"></el-table-column>
      <el-table-column prop="etime" label="运行时长"></el-table-column>
      <el-table-column prop="cpu" label="cpu使用率"></el-table-column>
      <el-table-column prop="memory" label="内存使用率"></el-table-column>
      <el-table-column prop="cmd" label="启动命令"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { Request } from "@/api/index.js";
export default {
  name: "test",
  data() {
    return {
      msg: "return data()",
      serviceStatus: [],
    };
  },
  methods: {
    checkServerStatus() {
      console.log("run the checkServerStatus...");
      Request({
        funcname: "checkServerStatus",
        data: { key: "123123" },
      }).then((res) => {
        console.log(res);
        this.serviceStatus = res.data.data;
      });
    },
  },
};
</script>

<style>
.el-header,
.el-footer {
  background-color: #47d82a;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #146fd8;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>